package uni.androidgame.mapgeneration;

import android.graphics.Color;

import java.util.HashMap;

import uni.androidgame.gameobjects.Monster;
import uni.androidgame.gameobjects.Tile;

public class MonsterGenerator
{

    private static final float percentRange = 0.1f;
    private static final HashMap<String,Integer> textureMap = new HashMap<String, Integer>(){{
        put("Rat",Color.WHITE);
        put("Bat",Color.GRAY);
        put("Goblin",Color.GREEN);
        put("MissingNO",Color.BLACK);
    }};

    public static Monster createMonster(Tile tile, int averageStr, int averageHP)
    {
        int str = MapGenerator.getRandom(averageStr*(1-percentRange),averageStr*(1+percentRange));
        int hp = MapGenerator.getRandom(averageHP*(1-percentRange),averageHP*(1+percentRange));
        String type = getType(str,hp);
        return new Monster(tile,type,str,hp,textureMap.get(type));
    }

    //Change to texture later
    private static String getType(int str,int hp)
    {
        if(str<10 && hp<10)
        {
            return "Rat";
        }
        else if(str<10 && hp>10)
        {
            return "Bat";
        }
        else if(str<15 && hp <15)
        {
            return "Goblin";
        }
        return "MissingNO";
    }
}
